body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f4f4f9;
}

.header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
}

.header-buttons-left, .header-buttons-right {
    position: absolute;
    display: flex;
    gap: 10px;
}

.header-buttons-left {
    left: 0;
}

.header-buttons-right {
    right: 0;
}

.gallery-btn, .settings-btn, .back-btn {
    background: none;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    color: #333;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.gallery-btn:hover, .settings-btn:hover, .back-btn:hover {
    background-color: #f0f0f0;
}

/* 下拉菜单样式 */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 4px;
    overflow: hidden;
}

.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    cursor: pointer;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* 占位符样式 */
.placeholder {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

/* 错误消息样式 */
.error-message {
    color: #d32f2f;
    background-color: #ffebee;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #f44336;
}

/* 操作按钮组样式 */
.actions {
    display: flex;
    gap: 10px;
}

.icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.settings-dialog, .gallery-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.gallery-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    width: 100%;
    max-width: 1400px;
    min-height: 600px;
    margin: 0 auto;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.gallery-actions {
    display: flex;
    gap: 10px;
}

.gallery-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
    align-items: center;
    flex-wrap: wrap;
}

#category-filter, #style-filter {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#search-input {
    flex: 1;
    min-width: 200px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#items-per-page {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 改进图标网格布局，使其更好地适应屏幕宽度 */
.gallery-container {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.gallery-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.gallery-item svg {
    width: 64px;
    height: 64px;
    margin-bottom: 10px;
}

.gallery-item-name {
    font-size: 14px;
    text-align: center;
    margin-bottom: 10px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery-item-actions {
    display: flex;
    gap: 5px;
}

.settings-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.dialog-buttons button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.dialog-buttons button:first-child {
    background-color: #4CAF50;
    color: white;
}

.dialog-buttons button:last-child {
    background-color: #f44336;
    color: white;
}

.save-btn {
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.save-btn:hover {
    background-color: #0b7dda;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* 三点图标菜单样式 */
.dropdown-container {
    position: fixed;
    top: 80px;
    right: calc(50% - 600px + 15px);
    z-index: 100;
}

/* 响应式调整 */
@media (max-width: 1240px) {
    .dropdown-container {
        right: 20px;
    }
}

.menu-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.menu-btn:hover {
    background-color: #f0f0f0;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 120px;
    z-index: 101;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu button {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
    padding: 8px 12px;
    transition: background-color 0.3s;
}

.dropdown-menu button:hover {
    background-color: #f5f5f5;
}

.dropdown-menu .icon {
    width: 16px;
    height: 16px;
}

h1 {
    text-align: center;
    color: #333;
}

.main-content {
    display: flex;
    gap: 20px;
}

.input-section, .result-section {
    flex: 1;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #fff;
}

.input-section h2, .result-section h2 {
    margin-top: 0;
    color: #444;
}

#prompt {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
}

.quantity-section {
    margin-bottom: 10px;
}

.quantity-section label {
    margin-right: 10px;
}

#quantity {
    width: 60px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 按钮组样式 */
.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.button-group button {
    flex: 1;
    padding: 10px;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

#generate-btn {
    background-color: #007BFF;
}

#generate-btn:hover {
    background-color: #0056b3;
}

#refresh-btn {
    background-color: #007BFF;
}

#refresh-btn:hover {
    background-color: #0056b3;
}

/* 禁用按钮样式 */
.button-group button:disabled {
    background-color: #cccccc !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
    pointer-events: none !important;
}

.button-group button:disabled:hover {
    background-color: #cccccc !important;
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.7 !important;
}

.progress-bar {
    height: 5px;
    background-color: #e0e0e0;
    margin-top: 10px;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: 0;
    background-color: #4CAF50;
    transition: width 0.3s;
}

.results-container {
    height: 500px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    background-color: #f9f9f9;
}

.status-bar {
    margin-top: 10px;
    padding: 5px 10px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}

.editor {
    margin-bottom: 20px;
}

#svg-code {
    width: 100%;
    height: 200px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    resize: vertical;
}

button {
    padding: 10px 15px;
    margin-right: 10px;
    background-color: #007BFF;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background-color: #0056b3;
}

.preview {
    border: 1px solid #ddd;
    padding: 20px;
    min-height: 200px;
    background-color: white;
}

/* SVG Preview Dialog Styles */
.preview-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.preview-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    width: 800px;
    max-width: 90%;
    height: 600px;
    max-height: 90%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

#close-preview {
    padding: 8px 16px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.preview-input-section {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

#svg-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: monospace;
}

#render-svg-btn {
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.preview-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pagination-controls {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 15px 0;
}

.pagination-controls button {
    padding: 6px 12px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    color: #333;
}

.pagination-controls button:hover:not(:disabled) {
    background-color: #e0e0e0;
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-controls #page-info {
    font-weight: bold;
    min-width: 60px;
    text-align: center;
}

/* 对话模式样式 */
.chat-section {
    flex: 1;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #fff;
    margin-bottom: 20px;
}

.chat-section h2 {
    margin-top: 0;
    color: #444;
    margin-bottom: 15px;
}

.chat-container {
    height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    background-color: #fafafa;
    margin-bottom: 15px;
}

.chat-message {
    display: flex;
    margin-bottom: 15px;
    gap: 12px;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-message.system .message-avatar {
    background-color: #007BFF;
    color: white;
}

.chat-message.user .message-avatar {
    background-color: #28a745;
    color: white;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    background-color: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 70%;
}

.chat-message.user .message-content {
    background-color: #e3f2fd;
    margin-left: auto;
}

.chat-message.system .message-content {
    background-color: #f5f5f5;
}

.message-content p {
    margin: 0;
    line-height: 1.4;
}

.chat-input-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#chat-prompt {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    resize: vertical;
    font-size: 14px;
    min-height: 60px;
}

.chat-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-controls .quantity-section {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-controls .quantity-section label {
    margin: 0;
    white-space: nowrap;
}

#chat-quantity {
    width: 50px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.chat-controls .style-section {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-controls .style-section label {
    margin: 0;
    white-space: nowrap;
}

#style-toggle {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#style-selector {
    display: none;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    min-width: 120px;
}

#send-chat-btn {
    padding: 10px 20px;
    background-color: #007BFF;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    margin-left: auto;
}

#send-chat-btn:hover {
    background-color: #0056b3;
}

#send-chat-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#refresh-chat-btn {
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

#refresh-chat-btn:hover {
    background-color: #218838;
}

#refresh-chat-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* 格式选择对话框样式 */
.format-dialog {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    text-align: center;
    min-width: 300px;
    color: #333; /* 确保文字颜色为深色 */
}

.format-dialog h3 {
    margin-bottom: 20px;
    color: #333;
}

.format-btn {
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f8f9fa;
    cursor: pointer;
    color: #333; /* 确保按钮文字颜色为深色 */
    transition: background-color 0.3s;
}

.format-btn:hover {
    background-color: #e9ecef;
}

.format-btn div:first-child {
    font-size: 24px;
    margin-bottom: 5px;
}

#cancel-format {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
    cursor: pointer;
    color: #333; /* 确保取消按钮文字颜色为深色 */
    transition: background-color 0.3s;
}

#cancel-format:hover {
    background-color: #e9ecef;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .chat-section,
    .input-section,
    .result-section {
        flex: none;
        width: 100%;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .chat-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .chat-controls .quantity-section {
        justify-content: space-between;
    }
}